package thread;

public class ThreadDemo3 {
    public static void main(String[] args) {
        Thread t1 = new Thread(){
            @Override
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    System.out.println("开心");
                }
            }
        };//继承thread的类，只用一次，改造为匿名内部类
        t1.start();

        Thread t2 = new Thread(()-> {
            for (int i = 0; i < 1000; i++) {
                System.out.println("高兴");
            }
        });//实现Runnable接口的类，匿名内部类转lambda表达式
        t2.start();
    }
}
